//
//  WelfareH5Model.m
//  quxiangtao
//
//  Created by xbmios on 2018/9/30.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "WelfareH5Model.h"

@implementation WelfareH5Model

+ (void)welfareFourH5withSuccess:(HttpRequestSuccess)successBlock fail:(HttpRequestFailed)failblock {
    
     NSString *string = [NSString stringWithFormat:@"{\"type\" : \"%@\"}",[RSA encryptString:@"2" publicKey:PublicKey]];
    
    [PPNetworkHelper POST:@"user/Welfare/H5detail" parameters:@{@"json":string} success:^(id responseObject) {
        
        NSLog(@"福利h5信息:%@", responseObject);
        
        NSArray *array = responseObject[@"data"];
        
        NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:responseObject];
        
        if (array.count > 0) {
            
            NSArray *arr = [WelfareH5Model mj_objectArrayWithKeyValuesArray:array];
            [dict removeObjectForKey:@"data"];
            [dict setObject:arr forKey:@"data"];
            
        }
        
        if (successBlock) {
            
            successBlock(dict);
        }
        
        /*
         describe = 更多活动等你来;
         title = 一豆夺宝;
         url = http://www.quxiangtao.com/H5/unopened/index.html;
         qdphoto = http://quxiang.zyhyjr.com/public/static/welfare/duobao.png;
         */
        
//        if ([responseObject[@"code"] integerValue] == 1) {
//
//            self.h5DataArr = [NSArray arrayWithArray:responseObject[@"data"]];
//
//        }else {
//
//            [[KYAlertView sharedInstance] showAlertViewWithMessage:responseObject[@"msg"]];
//        }
        
    } failure:^(NSError *error) {
        
        if (failblock) {
            
            failblock(error);
            
        }
    }];
}
@end
